from django.db import models

# Create your models here.


class Pub(models.Model):
    pname = models.CharField("出版社", max_length=20)

    def __str__(self):
        return f"{self.id}--{self.pname}"


class Book(models.Model):
    pub = models.ForeignKey(Pub, on_delete=models.CASCADE)
    bname = models.CharField('书名', max_length=20)

    def __str__(self):
        return f"{self.pub}--{self.bname}"
